#!/bin/sh
#
#
TestName="status-schedule-test"
JobName=BackupClient1
. scripts/functions

scripts/cleanup
scripts/copy-test-confs
/bin/cp -f  ${rconfigs}/${TestName}/susan-dir.conf.${TestName} ${conf}/susan-dir.conf
change_jobname $JobName

# Directory to backup.
# This directory will be created by setup_data().
BackupDirectory="${tmp}/data"

# Use a tgz to setup data to be backed up.
# Data will be placed at "${tmp}/data/".
setup_data data/small.tgz

# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
echo "${BackupDirectory}" >${tmp}/file-list


start_test

cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@$out ${cwd}/tmp/log1.out
messages
status scheduler
messages

@$out ${cwd}/tmp/log2.out
status scheduler days=1
messages

@$out ${cwd}/tmp/log3.out
status scheduler days=-1
messages

@$out ${cwd}/tmp/log4.out
status scheduler schedule=TestSchedule
messages

quit
END_OF_DATA

run_susan

stop_susan

NRLINES=`grep TestSchedule tmp/log1.out  | wc -l`
if [ $NRLINES = "169" ]; then
   print_debug "status scheduler OK"
else
   estat=1
fi

NRLINES=`grep TestSchedule tmp/log2.out  | wc -l`
if [ $NRLINES = "25" ]; then
   print_debug "status scheduler days=1 OK"
else
   estat=2
fi

NRLINES=`grep TestSchedule tmp/log3.out  | wc -l`
if [ $NRLINES = "25" ]; then
   print_debug "status scheduler days=-1 OK"
else
   estat=3
fi

NRLINES=`grep TestSchedule tmp/log4.out  | wc -l`
if [ $NRLINES = "170" ]; then
   print_debug "status scheduler schedule=TestSchedule OK"
else
   estat=4
fi

stop_susan

end_test
